<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            用户标识：<input type="text" name="openid"/>
                        </li>

                        <li>
                            是否订阅：<input type="text" name="subscribe"/>
                        </li>

                        <li>
                            昵称：<input type="text" name="nickname"/>
                        </li>

                        <li>
                            创建时间：<input type="text" name="createTime"/>
                        </li>

                        <li>
                            更新时间：<input type="text" name="updateTime"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="wx:user:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="wx:user:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="wx:user:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="wx:user:export">
                <i class="fa fa-download"></i> 导出
            </a>
            <!--<a class="btn btn-warning" onclick="$.wx.sendMsg()">-->
                <!--<i class="fa fa-download"></i> 发送消息-->
            <!--</a>-->
            <a class="btn btn-warning" onclick="sendTemplateMsg()">
                <i class="fa fa-send"></i> 发送模板消息
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('wx:user:edit')}]];
    var removeFlag = [[${@permission.hasPermi('wx:user:remove')}]];
    var prefix = ctx + "wx/user";

    var datas = [[${@dict.getType('sys_user_sex')}]];
    var subscribes = [[${@dict.getType('wx_user_subscribe')}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "微信用户",
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'headimgurl',
                    title: '头像',
                    sortable: true,
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<img src="' + value + '" width="90px" height="90px"/>')
                        return actions.join('');
                    }
                },
                {
                    field: 'openid',
                    title: '用户标识',
                    sortable: true
                },
                {
                    field: 'unionid',
                    title: 'unionid',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'subscribe',
                    title: '是否订阅',
                    sortable: true,
                    formatter:function(value,row,index){
                        return $.table.selectDictLabel(subscribes, value);
                    }
                },
                {
                    field: 'nickname',
                    title: '昵称',
                    sortable: true
                },
                {
                    field: 'sex',
                    title: '性别',
                    sortable: true,
                    formatter:function(value,row,index){
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'language',
                    title: '语言',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'city',
                    title: '城市',
                    sortable: true
                },
                {
                    field: 'province',
                    title: '省份',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'country',
                    title: '国家',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'subscribeTime',
                    title: '关注时间',
                    sortable: true
                },
                {
                    field: 'remark',
                    title: '备注',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'groupid',
                    title: '分组ID',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'tagidList',
                    title: '标签ID列表',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'subscribeScene',
                    title: '关注的渠道来源',
                    sortable: true,
                    formatter:function(value,row,index){
                        return $.wx.subscribeScene(value);
                    }
                },
                {
                    field: 'qrScene',
                    title: '扫码场景',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'qrSceneStr',
                    title: '扫码场景描述',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'updateTime',
                    title: '更新时间',
                    sortable: true,
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });





</script>

</body>
</html>